<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

	<title>Class: Rask::Task</title>

	<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />

	<script src="../js/jquery.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="../js/thickbox-compressed.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="../js/quicksearch.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="../js/darkfish.js" type="text/javascript"
		charset="utf-8"></script>

</head>
<body class="class">

	<div id="metadata">
		<div id="file-metadata">
			<div id="file-list-section" class="section">
				<h3 class="section-header">In Files</h3>
				<div class="section-body">
					<ul>
					
						<li><a href="../lib/rask_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="lib/rask.rb">lib/rask.rb</a></li>
					
					</ul>
				</div>
			</div>

			
		</div>

		<div id="class-metadata">

			<!-- Parent Class -->
			
			<div id="parent-class-section" class="section">
				<h3 class="section-header">Parent</h3>
				
				<p class="link">Object</p>
				
			</div>
			

			<!-- Namespace Contents -->
			

			<!-- Method Quickref -->
			
			<div id="method-list-section" class="section">
				<h3 class="section-header">Methods</h3>
				<ul class="link-list">
					
					<li><a href="#M000000">::new</a></li>
					
					<li><a href="#M000005">#destroy</a></li>
					
					<li><a href="#M000006">#destroy?</a></li>
					
					<li><a href="#M000003">#read_only</a></li>
					
					<li><a href="#M000004">#read_only?</a></li>
					
					<li><a href="#M000001">#run</a></li>
					
					<li><a href="#M000002">#transition</a></li>
					
				</ul>
			</div>
			

			<!-- Included Modules -->
			
			<div id="includes-section" class="section">
				<h3 class="section-header">Included Modules</h3>
				<ul class="link-list">
				
				
					<li><span class="include">StateMachine</span></li>
				
				
				</ul>
			</div>
			
		</div>

		<div id="project-metadata">
			
			

			<div id="classindex-section" class="section project-section">
				<h3 class="section-header">Class Index
					<span class="search-toggle"><img src="../images/find.png"
						height="16" width="16" alt="[+]"
						title="show/hide quicksearch" /></span></h3>
				<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
				<fieldset>
					<legend>Quicksearch</legend>
					<input type="text" name="quicksearch" value=""
						class="quicksearch-field" />
				</fieldset>
				</form>

				<ul class="link-list">
				
					<li><a href="../Rask.html">Rask</a></li>
				
					<li><a href="../Rask/Task.html">Rask::Task</a></li>
				
				</ul>
				<div id="no-class-search-results" style="display: none;">No matching classes.</div>
			</div>

			
		</div>
	</div>

	<div id="documentation">
		<h1 class="class">Rask::Task</h1>

		<div id="description">
			<table>
<tr><td valign="top">Authors:</td><td>mewlist / Hidenori Doi

</td></tr>
<tr><td valign="top">Copyright:</td><td>Copyright (C) 2010 mewlist / Hidenori Doi

</td></tr>
<tr><td valign="top">License:</td><td>The MIT License

</td></tr>
</table>
<h2><a href="Task.html">Task</a> base class</h2>
<p>
To define new <a href="Task.html">Task</a> you must inherit this base-class
</p>
<ul>
<li>Transition function is defined automatically, named transition_to_[state]

</li>
<li>For this sample, transition_to_finish is defined.

</li>
</ul>
<h4>sample code</h4>
<pre>
   class NewTask &lt; Rask::Task
     define_state :initial, :initial =&gt; true
     define_state :finish
     def initial
       transition_to_finish
     end
     def finish
       destroy
     end
   end
</pre>

		</div>

		<!-- Constants -->
		

		<!-- Attributes -->
		
		<div id="attribute-method-details" class="method-section section">
			<h3 class="section-header">Attributes</h3>

			
			<div id="task-id-attribute-method" class="method-detail">
				<a name="task_id"></a>
				
				<a name="task_id="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">task_id</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				
				
				</div>
			</div>
			
			<div id="group-attribute-method" class="method-detail">
				<a name="group"></a>
				
				<a name="group="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">group</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				
				
				</div>
			</div>
			
			<div id="state-attribute-method" class="method-detail">
				<a name="state"></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">state</span><span
						class="attribute-access-type">[R]</span>
				</div>

				<div class="method-description">
				
				
				
				</div>
			</div>
			
		</div>
		

		<!-- Methods -->
		
		<div id="public-class-method-details" class="method-section section">
			<h3 class="section-header">Public Class Methods</h3>

		
			<div id="new-method" class="method-detail ">
				<a name="M000000"></a>

				<div class="method-heading">
				
					<span class="method-name">new</span><span
						class="method-args">(_group=nil)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<dl>
<dt>_group</dt><dd>group name to classify. You can filter task group when call
<b>Rask::task_ids / Rask::daemon</b> methods.

</dd>
</dl>
<h3>If group option is given, the task is classified by group name.</h3>
<h4>sample code</h4>
<pre>
 Rask::insert NewTask.new('group_name')
 Rask::daemon(:group =&gt; 'group_name')
</pre>
					

					
					<div class="method-source-code"
						id="new-source">
<pre>
<span class="ruby-comment cmt"># File lib/rask.rb, line 87</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">_group</span>=<span class="ruby-keyword kw">nil</span>)
      <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">group</span> = <span class="ruby-identifier">_group</span>
      <span class="ruby-keyword kw">super</span>()
    <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				
			</div>

		
		</div>
	
		<div id="public-instance-method-details" class="method-section section">
			<h3 class="section-header">Public Instance Methods</h3>

		
			<div id="destroy-method" class="method-detail ">
				<a name="M000005"></a>

				<div class="method-heading">
				
					<span class="method-name">destroy</span><span
						class="method-args">()</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="destroy-source">
<pre>
<span class="ruby-comment cmt"># File lib/rask.rb, line 120</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy</span>
      <span class="ruby-identifier">transition</span> <span class="ruby-keyword kw">nil</span>
    <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				
			</div>

		
			<div id="destroy--method" class="method-detail ">
				<a name="M000006"></a>

				<div class="method-heading">
				
					<span class="method-name">destroy?</span><span
						class="method-args">()</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="destroy--source">
<pre>
<span class="ruby-comment cmt"># File lib/rask.rb, line 125</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy?</span>
      <span class="ruby-ivar">@state</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
    <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				
			</div>

		
			<div id="read-only-method" class="method-detail ">
				<a name="M000003"></a>

				<div class="method-heading">
				
					<span class="method-name">read_only</span><span
						class="method-args">()</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="read-only-source">
<pre>
<span class="ruby-comment cmt"># File lib/rask.rb, line 110</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_only</span>
      <span class="ruby-ivar">@read_only</span> = <span class="ruby-keyword kw">true</span>
    <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				
			</div>

		
			<div id="read-only--method" class="method-detail ">
				<a name="M000004"></a>

				<div class="method-heading">
				
					<span class="method-name">read_only?</span><span
						class="method-args">()</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="read-only--source">
<pre>
<span class="ruby-comment cmt"># File lib/rask.rb, line 115</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_only?</span>
      <span class="ruby-ivar">@read_only</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>
    <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				
			</div>

		
			<div id="run-method" class="method-detail ">
				<a name="M000001"></a>

				<div class="method-heading">
				
					<span class="method-name">run</span><span
						class="method-args">()</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<h3>automatically callbacked from task engine.</h3>
					

					
					<div class="method-source-code"
						id="run-source">
<pre>
<span class="ruby-comment cmt"># File lib/rask.rb, line 95</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
      <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">read_only?</span>
      <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@state</span>
        <span class="ruby-identifier">eval</span> <span class="ruby-ivar">@state</span>.<span class="ruby-identifier">to_s</span>
      <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				
			</div>

		
			<div id="transition-method" class="method-detail ">
				<a name="M000002"></a>

				<div class="method-heading">
				
					<span class="method-name">transition</span><span
						class="method-args">(to)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<h3>Transition to new state. In the state function.</h3>
<p>
Usually you should call generated transition_to_[state name] function
</p>
					

					
					<div class="method-source-code"
						id="transition-source">
<pre>
<span class="ruby-comment cmt"># File lib/rask.rb, line 105</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">transition</span>(<span class="ruby-identifier">to</span>)
      <span class="ruby-ivar">@state</span> = <span class="ruby-identifier">to</span>
    <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				
			</div>

		
		</div>
	

	</div>


	<div id="rdoc-debugging-section-dump" class="debugging-section">
	
		<p>Disabled; run with --debug to generate this.</p>
	
	</div>

	<div id="validator-badges">
		<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
		<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
			Rdoc Generator</a> 1.1.6</small>.</p>
	</div>

</body>
</html>

